using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
namespace MicroMsg.UI.UserContrl
{
	public class MasterPagePicItem : UserControl
	{
		public delegate void ListItemClick(object sender, object object_0);
		private const string TAG = "MasterPagePicItem";
		private const SolidColorBrush cBrushCoverNormal = null;
		private const double cDMoveRestrict = 25.0;
		public int mNPicIndex = -1;
		private static SolidColorBrush cBrushCoverTouch;
		private bool mBIsClickCancled;
		internal Image imgContent;
		internal Grid gridCover;
		private bool _contentLoaded;
		public event MasterPagePicItem.ListItemClick ItemClick;
		public MasterPagePicItem()
		{
			this.InitializeComponent();
		}
		private void btnLayoutRoot_Click(object sender, RoutedEventArgs e)
		{
			this.clicked();
		}
		private void clicked()
		{
			if (this.ItemClick != null)
			{
				this.ItemClick(this, this.mNPicIndex);
			}
		}
		private void Grid_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
		{
			this.mBIsClickCancled = false;
			this.gridCover.set_Background(MasterPagePicItem.cBrushCoverTouch);
		}
		private void Grid_ManipulationDelta(object sender, ManipulationDeltaEventArgs e)
		{
			Point translation = e.get_DeltaManipulation().get_Translation();
			if (translation.get_X() * translation.get_X() + translation.get_Y() * translation.get_Y() > 25.0)
			{
				this.gridCover.set_Background(null);
				this.mBIsClickCancled = true;
			}
		}
		private void Grid_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
		{
			this.gridCover.set_Background(null);
			if (!this.mBIsClickCancled)
			{
				this.clicked();
			}
		}
		[DebuggerNonUserCode]
		public void InitializeComponent()
		{
			if (this._contentLoaded)
			{
				return;
			}
			this._contentLoaded = true;
			Application.LoadComponent(this, new Uri("/MicroMsg;component/Source/Plugin/Sns/Common/UI/AlbumCover/MasterPagePicItem.xaml", 2));
			this.imgContent = (Image)base.FindName("imgContent");
			this.gridCover = (Grid)base.FindName("gridCover");
		}
		static MasterPagePicItem()
		{
			// Note: this type is marked as 'beforefieldinit'.
			SolidColorBrush solidColorBrush = new SolidColorBrush();
			solidColorBrush.set_Color(Color.FromArgb(153, 0, 0, 0));
			MasterPagePicItem.cBrushCoverTouch = solidColorBrush;
		}
	}
}
